<template>
  <router-view />
</template>

<script setup>
import { onMounted, nextTick, onErrorCaptured } from 'vue'
import useSettingsStore from '@/store/modules/settings'
import { handleThemeStyle } from '@/utils/theme'

onMounted(() => {
  nextTick(() => {
    // 初始化主题样式
    handleThemeStyle(useSettingsStore().theme)
  })
})

// Global error handling
onErrorCaptured((err, instance, info) => {
  console.error('App-level error captured:', err);
  console.error('Error occurred in component:', instance);
  console.error('Error info:', info);
  
  // Return false to prevent the error from propagating to the browser console
  // Return true to allow the error to propagate
  return true;
})
</script>
